package com.czkt.service.Impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.czkt.mapper.BooksClassMapper;
import com.czkt.pojo.Booksclass;
import com.czkt.service.BooksClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service
public class BooksClassServiceImpl extends ServiceImpl<BooksClassMapper, Booksclass> implements BooksClassService {

    @Override
    public List<Booksclass> list(Integer classID) {
        QueryWrapper<Booksclass> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(classID!=null,Booksclass::getClassLevel, classID);
        return baseMapper.selectList(queryWrapper);
    }
    @Override
    public List<Booksclass> list(Set<Long> classID) {
        QueryWrapper<Booksclass> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().in(!classID.isEmpty(),Booksclass::getClassLevel, classID);
        return baseMapper.selectList(queryWrapper);
    }
}
